home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / TextHarvest / TextHarvest-Install.exe / {app} / Help-TextHarvest.txt < prev    next >
Text File  |  2005-02-23  |  33KB  |  606 lines

  1. <a name="TOP"><H1>User Manual: TextHarvest</H1>
  2.  
  3. <fs X="0.2">
  4. </fs><hl>               <fs X="1.2"><b>For additional help files, click <a href="exec:PommelScan">here</a>.</b></fs></hl>
  5.  
  6. <a name="TOC"><H2>Table of Contents</H2>
  7.  
  8. You can click on any section title below to jump directly to that section.
  9.  
  10.    <a href="#INTRODUC"><b>Introduction</b></a>
  11.       <a href="#FIRSTUQU">First-Time User Questions</a>
  12.       <a href="#OVERVIEW">General Overview</a>
  13.       <a href="#SIMPEXAM">A Simple Example</a>
  14.       <a href="#ANOTEXAM">Another Example</a>
  15.    <a href="#THBASICS"><b>TextHarvest Basics</b></a>
  16.       <a href="#WORDLSTS">Word Lists</a>
  17.          <a href="#SPECALOW">Specifying a List of Words</a>
  18.          <a href="#COMBKAND">Combining Keep and Delete</a>
  19.       <a href="#CONTINPB">The Controls Input Box</a>
  20.          <a href="#TEXTCASE">Text Case</a>
  21.          <a href="#NULLLINE">Null Lines</a>
  22.          <a href="#FNAMEANO">File Name Annotation</a>
  23.          <a href="#REGEXP00">Regular Expressions</a>
  24.      <a href="#OTHRCONT">Other Controls</a>
  25.    <a href="#ADVANCED"><b>Advanced Techniques</b></a>
  26.       <a href="#SHORTCTK">Shortcut Keys</a>
  27.       <a href="#WILDCRDS">Wildcards</a>
  28.          <a href="#MULTWDCS">Multiple Wildcards</a>
  29.       <a href="#CLIPBORD">Processing the Windows Clipboard</a>
  30.       <a href="#BOOLFILT">Boolean Filtering (Anding)</a>
  31.       <a href="#CMDLINEPS">Command Line Parameters</a>
  32.       <a href="#BATCHFIL">Batch File Considerations</a>
  33.          <a href="#ERRORFIL">The Error Reporting File</a>
  34.          <a href="#MSGLOGFL">The Log File</a>
  35.    <a href="#USAGNOTS"><b>Usage Notes</b></a>
  36.       <a href="#MATCHPRB">Matching Problems</a>
  37.          <a href="#FALSMATC">False Matches</a>
  38.          <a href="#FINDSLAS">Finding Slashes</a>
  39.      <a href="#FILEFMTS">File Formats</a>
  40.    <a href="#REGEXPRS"><b>Regular Expression Syntax</b></a>
  41.       <a href="#REGEXPOV">Overview</a>
  42.       <a href="#REBASICS">Basic Regular Expressions</a>
  43.          <a href="#RXAST">Using the Asterisk</a>
  44.       <a href="#REASTERK">Advanced Regular Expressions</a>
  45.    <a href="#SCRIPTNG"><b>Scripting</b></a>
  46.       <a href="#SCSEXAMP">A Simple Example</a>
  47.       <a href="#SCRUSERM">Scripting User Manual
  48.       <a href="#SCSAMPLE">Sample Scripts</a>
  49.    <a href="#UNINSTAL"><b>Uninstalling TextHarvest</b></a>
  50.    <a href="#CUSTOMCO"><b>Custom Conversion</b></a>
  51.    <a href="#LEGALESE"><b>Legal Notices</b></a>
  52.    <a href="#AUTABOUT"><b>About TextHarvest</b></a>
  53.  
  54. Additional documentation (such as version history) can be found in the <a href="file://ReadMe.txt">ReadMe.txt</a> file.
  55.  
  56. <a name="INTRODUC"><H1>Introduction</H1>
  57.  
  58. <a name="FIRSTUQU"><H2>First-Time User Questions</H2>
  59.  
  60. <hl>What does TextHarvest do?</hl>
  61.  
  62.   It reads files and copies the information you want, altering it in various
  63.   ways you specify.
  64.  
  65. <hl>What kinds of files can it process?</hl>
  66.  
  67.   Text (Windows, DOS, Unix, Macintosh), fixed-record-length, and character-
  68.   terminated.
  69.  
  70. <hl>How much does TextHarvest cost?</hl>
  71.  
  72.   For most people: nothing. Certain exceptionally powerful capabilities
  73.   require that you purchase a special license, but the average user will
  74.   not need these.
  75.  
  76. <hl>Can I give copies of TextHarvest to other people?</hl>
  77.  
  78.   Yes.
  79.  
  80. <hl>Can I sell copies of TextHarvest to other people?</hl>
  81.  
  82.   No. You can charge a small distribution fee, though.
  83.  
  84. <hl>I'm a programmer, so why would I need TextHarvest?</hl>
  85.  
  86.   Many operations that would take 100 lines of code in a traditional
  87.   programming language can be performed with a single script command.
  88.  
  89. <a name="OVERVIEW"><H2>General Overview</H2>
  90.  
  91. In its simplest form, TextHarvest is a utility that copies a text file. As it does so, it can:
  92. <HL>
  93.   ò Retain lines that contain specific text
  94.   ò Skip   lines that contain specific text
  95. </HL>
  96. Thus, you can use TextHarvest to filter a text file, preserving only those lines that interest you.
  97.  
  98. You can also use powerful <a href="#SCRIPTNG">scripts</a> to:
  99. <hl>
  100.   ò Process files other than plain text
  101.   ò Modify the data sent to the output file
  102.   ò Perform further filtering and analysis
  103. </hl>
  104. Here are some typical scripted operations:
  105. <hl>
  106.   ò Change one word to another one
  107.   ò Change uppercase to lowercase
  108.   ò Rearrange columns of text
  109.   ò Look up values in a table
  110.   ò Convert data to CSV (Comma Separated Value) format
  111. </hl>
  112. But for now, let's start with the basics ...
  113.  
  114. <a name="SIMPEXAM"><H2>A Simple Example</H2>
  115.  
  116. TextHarvest comes with a demonstration file, named <a href="file://ThingsToDo.txt">ThingsToDo.txt</a> (click to view), which contains a simple "To Do" list. You can view this file by entering the name in the "Input File" box then clicking the corresponding View button.
  117.  
  118. The first column contains a category, such as "Car, Home, Work", while the second column describes the task to be done.
  119.  
  120. Let us say you only wanted to see the lines that contained the word "Work". Here is the way to do this:
  121. <HL>
  122.   ò Specify the input file name (ThingsToDo.txt)
  123.   ò Specify an output file name (Output.txt)
  124.   ò Make sure Autoview is checked and Append is <i>not</i> checked
  125.   ò Make sure the "Script file" input box contains the word "None" (no quotes)
  126.   ò Put the word "Work" in the "/Keep list" like this:  /Work
  127.   ò Click the Start button (shortcut key: F9)
  128. </HL>
  129. TextHarvest will then read <a href="file://ThingsToDo.txt">ThingsToDo.txt</a> and copy only those lines that contain the word "Work" (or variations such as "WORK", or "work"). Then, because you checked "Autoview", the output file (Output.txt) will be displayed.
  130.  
  131. Note:  The reason we put a slash ("/") character in front of the word "Work" is explained later, in the section "<a href="#SPECALOW">Specifying a List of Words</a>".
  132.  
  133. <a name="ANOTEXAM"><H2>Another Example</H2>
  134.  
  135. Now let us suppose that you want to do the opposite of what you did in the previous example:  you want to see every line <i>except</i> those that contain the word "Work". Remove the word "Work" from the "/Keep list" input box and put it in the "/Delete list" box like this:
  136.  
  137. <HL>  /Work</HL>
  138.  
  139. When you click the Start button, TextHarvest will copy the file (<a href="file://ThingsToDo.txt">ThingsToDo.txt</a>) to the output file but will remove any lines that contain the word "Work".
  140.  
  141. <a name="THBASICS"><H1>TextHarvest Basics</H1>
  142.  
  143. <a name="WORDLSTS"><H2>Word Lists</H2>
  144.  
  145. <a name="SPECALOW"><H3>Specifying a List of Words</H3>
  146.  
  147. Once again using <a href="file://ThingsToDo.txt">ThingsToDo.txt</a>, let us copy only those lines that contain the word "Home", or "Work", or both.
  148.  
  149. Make sure that the "/Delete list" input box is empty, then enter the following in the "/Keep list" input box:
  150.  
  151. <HL>  /home/work</HL>
  152.  
  153. When you click the Start button, the file will be copied ù but only those lines that contain "Home" or "Work" (with variations, such as "HOME", "Work" and so on).
  154.  
  155. <a name="COMBKAND"><H3>Combining Keep and Delete</H3>
  156.  
  157. You can specify both Keep and Delete lists. For example, let us say you used the following criteria:
  158. <HL>
  159.   /Keep list:    /work/home
  160.   /Delete list:  /inventory
  161. </HL>
  162. This would copy any lines with the words "work" or "home", but which do <i>not</i> contain the word "inventory".
  163.  
  164. When Keep and Delete lists are both specified, a line is first checked to see if it passes the "Keep" test. If so, it is then compared to the "Delete" list. If a match is found, the line is <i>not</i> copied.
  165.  
  166. <a name="CONTINPB"><H2>The Controls Input Box</H2>
  167.  
  168. <a name="TEXTCASE"><H3>Text Case</H3>
  169.  
  170. By default, TextHarvest will ignore text case when looking at the "/Keep list" and the "/Delete list". You can override this behaviour, though, using the "/Controls" input box. Here are the various settings:
  171. <HL>
  172.   /KI = Ignore case on Keep (default)
  173.   /KM = Match case on Keep
  174.   /DI = Ignore case on Delete (default)
  175.   /DM = Match case on Delete
  176. </HL>
  177. Try using the sample input file <a href="file://ThingsToDo.txt">ThingsToDo.txt</a> to test this out:
  178. <HL>
  179.   ò Make sure the "Script file" input box contains the word "None" (no quotes)
  180.   ò Set your "/Keep list" to "/CAR/work"
  181.   ò Make sure your "/Delete list" is empty
  182.   ò Set your "/Controls" input box to "/KM"
  183.   ò Click the Start button
  184. </HL>
  185. The output will contain references to "CAR", but will ignore the lines that start with "WORK" because "WORK" (which is in uppercase) does not match "work" (which is in lowercase).
  186.  
  187. <a name="NULLLINE"><H3>Null Lines</H3>
  188.  
  189. By default, TextHarvest ignores all null (zero-length) lines in the input file. However, you can set the "/Controls" input box to deal with this. Here are the settings:
  190. <HL>
  191.   /NI = Ignore null lines (default)
  192.   /NK = Keep null lines
  193.   /NS = Keep null lines, but never output more than two in a row
  194. </HL>
  195. Try using the sample input file <a href="file://ThingsToDo.txt">ThingsToDo.txt</a> to test this out...
  196. <HL>
  197.   ò Make sure the "Script file" input box contains the word "None" (no quotes)
  198.   ò Clear the "/Keep list" input box
  199.   ò Set "/Delete list" to "/car/work"
  200.   ò Set "/Controls" to "/NK".
  201.   ò Click the Start button
  202. </HL>
  203. The output will <i>not</i> contain any lines containing "car" or "work", but it <i>will</i> contain any null lines found in the input file.
  204.  
  205. Try the experiment again, first with "/NS" and then with "/NI". (Since "/NI" is the default, you could also simply leave the "/Controls" input box blank.)
  206.  
  207. <a name="FNAMEANO"><H3>File Name Annotation</H3>
  208.  
  209. If you are processing multiple files using <a href="#WILDCRDS">wildcards</a>, you may wish to know which output lines came from which files. TextHarvest can annotate the output such that the file name precedes lines extracted from a particular file:
  210. <HL>
  211.   /FN = No, do not output the file name (default)
  212.   /FY = Yes, output the file name
  213.   /FS = Yes, output the file name, and put separator lines above and below
  214. </HL>
  215. The separator line (control /FS) makes it easier to spot the file names in a long output file.
  216.  
  217. Only the file names of files that actually generate output lines are included. If a file does not generate any input lines, its name is not mentioned.
  218.  
  219. File name annotation lets you use TextHarvest as a "Find Text" utility. For example, if you wanted to search a folder for the word "inventory", you could do this:
  220. <HL>
  221.   ò Set the "Input file" box to the wildcard "Things*.txt" (without the quotes)
  222.   ò Make sure the "Script file" input box contains the word "None"
  223.   ò Set the "/Keep list" input box to "/inventory"
  224.   ò Make sure your "/Delete list" is empty
  225.   ò Set the "/Controls" input box to "/FS" or "/FY"
  226.   ò Click the Start button
  227. </HL>
  228. The example given above would search all files matching the wildcard pattern Things*.txt extension for the word "inventory".
  229.  
  230. <a name="REGEXP00"><H3>Regular Expressions</H3>
  231.  
  232. By default, TextHarvest will search for the precise text fragments you specify in the /Keep and /Delete lists. However, you can enable "regular expressions", which let you match patterns rather than specific sequences of characters:
  233. <HL>
  234.   /KR = Enable regular expressions for the /Keep list
  235.   /DR = Enable regular expressions for the /Delete list
  236. </HL>
  237. Consider the following /Keep list:
  238.  
  239. <HL>  /D.g/C[aou]t</HL>
  240.  
  241. With /KR specified in the "/Controls" input box, this would match any line that contained "Dog", "Cat", "Cot", "Cut". It would also match lines containing "Dig" and "D3g", so when you are using regular expressions you must ensure that you are indicating precisely what you want.
  242.  
  243. If you have never used regular expressions before, you may find them a bit confusing at first, but with a bit of practice you will come to appreciate just how much power they put at your fingertips.
  244.  
  245. Please see "<a href="#REGEXPRS">Regular Expression Syntax</a>" for additional examples of regular expressions.
  246.  
  247. <a name="OTHRCONT"><H2>Other Controls</H2>
  248.  
  249. <b><HL>Autoview</HL></b>, if checked, displays the output file after processing (if there is anything to display). If it is not checked, you have to click the View button to see the output.
  250.  
  251. <b><HL>Append</HL></b>, if checked, places the output at the end of the specified output file. If it is not checked, the original copy of the output file (if it exists) is renamed with a .BAK extension and a new version is created.
  252.  
  253. <a name="ADVANCED"><H1>Advanced Techniques</H1>
  254.  
  255. <a name="SHORTCTK"><H2>Shortcut Keys</H2>
  256.  
  257. In addition to the standard Windows shortcut key conventions (i.e. pressing Alt plus a letter that is underlined), the following shortcut keys are defined:
  258. <hl>
  259.   ùùù  ùùùùùùùùùùùùùùùùùùùùù  ùùù  ùùùùùùùùùùùùùùùùùùùùù
  260.   <b>Key  Action                 Key   Action</b>
  261.   ùùù  ùùùùùùùùùùùùùùùùùùùùù  ùùù  ùùùùùùùùùùùùùùùùùùùùù
  262.   F1   Show help              F6   Browse script file
  263.   F2   Browse input file      F7   Browse support file
  264.   F3   Browse output file     F9   Start processing
  265.   ùùù  ùùùùùùùùùùùùùùùùùùùùù  ùùù  ùùùùùùùùùùùùùùùùùùùùù
  266. </hl>
  267. The Esc (Escape) key will close most windows opened by TextHarvest.
  268.  
  269. <a name="WILDCRDS"><H2>Wildcards</H2>
  270.  
  271. You can process more than one input file at a time by using wildcards. For example, if you set the input file box to *.txt then all files with a .txt extension will be processed. Here are some more examples:
  272. <HL>
  273.   ùùùùùùùùùùùùù  ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
  274.   <b>Wildcard Mask  Interpretation</b>
  275.   ùùùùùùùùùùùùù  ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
  276.   report??.txt   "report" followed by any two characters, .txt extension
  277.   my*.csv        "my" followed by one or more characters, .csv extension
  278.   xyz.???        "xyz" with any three-character extension
  279.   ùùùùùùùùùùùùù  ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
  280. </HL>
  281. Note that the asterisk (*) is interpreted differently in <a href="#REGEXP00">regular expressions</a> than it is in file name wildcards.
  282.  
  283. You cannot specify wildcards for the output file. All output goes to a single output file.
  284.  
  285. <a name="MULTWDCS"><H3>Multiple Wildcards</H3>
  286.  
  287. You can specify multiple wildcards by using semicolons, as in this example:
  288.  
  289. <HL>  *.txt;*.me</HL>
  290.  
  291. This would process input files with the .txt exension (example: xyz.txt) and the .me extension (example: read.me).
  292.  
  293. There is no limit to the number of wildcards you specify, but bear in mind that TextHarvest lets you process the same file more than once. Consider this example:
  294.  
  295. <HL>  *.txt;my*.txt</HL>
  296.  
  297. This would process all files with a .txt extension, then all files with a .txt extension where the file name starts with "my". Thus, a file named "myfile.txt" would be processed twice.
  298.  
  299. You cannot specify multiple file names for the output file. All output goes to a single output file.
  300.  
  301. <a name="CLIPBORD"><H2>Processing the Windows Clipboard</H2>
  302.  
  303. TextHarvest can read and write to the Windows text clipboard as if it was a regular text file. To read from the clipboard, enter CLIPBOARD in the "Input File" box. To write to the clipboard, enter CLIPBOARD in the "Output File" box.
  304.  
  305. It is possible to do both at once. Of course, after processing, the original contents of the clipboard will have been overwritten.
  306.  
  307. Tip:  Most Windows programs let you copy selected text with Ctrl-C and paste with Ctrl-V.
  308.  
  309. <a name="BOOLFILT"><H2>Boolean Filtering (Anding)</H2></a>
  310.  
  311. Note: You can use the sample file <a href="file://ThingsToDo.txt">ThingsToDo.txt</a> to try out the examples given below. The examples should be entered in your /Keep list. Make sure that the "/Delete" and "/Controls" input boxes are empty, and that the "Script file" input box is set to "None".
  312.  
  313. The lists of words (see "<a href="#WORDLSTS">Word Lists</a>") you enter in the "/Keep list" and "/Delete list" input boxes are typically a sequence of alternatives. For example, if your /Keep list is "/Cat/Dog/Cow" it means you want to keep lines that contain "Cat" or "Dog" or "Cow". This is called an "OR-list".
  314.  
  315. However, sometimes you want to keep lines that contain all of the words you listed. That is to say, if even one of the words is missing, you don't want to keep the line. For this you need an "AND-list".
  316.  
  317. TextHarvest's AND function is represented by two ampersands. Here is an example of ANDing...
  318.  
  319. <HL>  /Cat&&/Dog&&/Cow</HL>
  320.  
  321. This will match any line that contains all three (Cat, Dog and Cow).
  322.  
  323. You can combine ANDing and ORing, as in this example:
  324.  
  325. <HL>  /Cat/Dog/Cow&&/Moose</HL>
  326.  
  327. This will match any line that contains any one of the first three items (Cat or Dog or Cow) AND also contains the word Moose.
  328.  
  329. Now consider this example:
  330.  
  331. <HL>  /Cat/Dog/Cow&&/Moose/Antelope</HL>
  332.  
  333. This will match any line that contains one of the first three items (Cat or Dog or Cow) AND also contains one of the next two items (Moose or Antelope).
  334.  
  335. If <i>any</i> of the AND conditions is not met, the line does not match. For example, consider this list:
  336.  
  337. <HL>  /North/South&&/Up/Down&&/Back/Forth</HL>
  338.  
  339. A line that contains North, Up and Back would match. A line that contains South, Down and Back would match. But a line that is missing both North and South would <i>not</i> match.
  340.  
  341. <a name="CMDLINEPS"><H2>Command Line Parameters</H2>
  342.  
  343. To call TextHarvest from the command line (e.g. from a <a href="#BATCHFIL">batch file</a> or in a Windows shortcut), the following format is used:
  344.  
  345. <HL>  TextHarvest /i"Input.txt" /o"Output.txt"</HL>
  346.  
  347. You can also specify the /Keep, /Delete and /Controls lists:
  348. <HL>
  349.   /X"/keep/list"
  350.   /Y"/delete/list"
  351.   /Z"/control/list"
  352. </HL>
  353. To specify a script file, use /S as in this example:
  354. <hl>
  355.   /S"ScriptSample01.txt"
  356. </hl>
  357. If you are not using a script, you should specify /S"None" to override whatever value TextHarvest had previously saved for that input box.
  358.  
  359. For a general overview of command line parameters, start up TextHarvest as follows:
  360.  
  361. <HL>  TextHarvest /?</HL>
  362.  
  363. This displays a window which summarizes the command-line options. The window is also displayed if your command line contains an option that TextHarvest does not recognize.
  364.  
  365. <a name="BATCHFIL"><H2>Batch File Considerations</H2>
  366.  
  367. When calling TextHarvest from a batch file, you must use the Windows START command with the /WAIT option to allow TextHarvest to complete processing before moving to the next line in the batch file.
  368.  
  369. If the batch file is running unattended, you should also feed TextHarvest the following parameters:
  370. <HL>
  371.   ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
  372.   /R      Run (i.e. start) processing immediately
  373.   /CA     Close the program after execution, even if there is an error
  374.   ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
  375. </HL>
  376. Thus, a batch file line that calls TextHarvest would contain the items exemplified below:
  377. <HL>
  378.   ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
  379.   START
  380.   /WAIT                                    <ùù Await completion
  381.   "C:\Program Files\PinnSoft\TextHarvest\TextHarvest.exe"
  382.   /I"C:\My Input\Input*.dat"               <ùù Input file or wildcard mask
  383.   /O"C:\My Output\Output.txt"              <ùù Output file
  384.   /S"None"                                 <ùù Script file
  385.   /R                                       <ùù Start processing
  386.   /CA                                      <ùù End afterwards
  387.   ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
  388. </HL>
  389. Note the use of quotes ù these are necessary if the parameter contains a space.
  390.  
  391. <a name="ERRORFIL"><H3>The Error Reporting File</H3>
  392.  
  393. If a serious error occurs during processing, TextHarvest creates a file named TextHarvest-Error.txt in its program directory. The file is plain text and contains information about the error. You can view the Error Reporting File using the "Support Files" input box of the Parsing Parameters window; it will be listed in the drop-down list.
  394.  
  395. If no error occurs, the file is <i>not</i> present after processing is complete.
  396.  
  397. If you are using TextHarvest in a batch file, you can check to see if processing worked by using the IF EXIST test, as in this example:
  398. <HL>
  399.   ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
  400.   @ECHO OFF
  401.   C:
  402.   CD "\Program Files\Pinnsoft\TextHarvest"
  403.   START /WAIT TextHarvest.exe /I"C:\MyInput\XYZ.TXT" /R /CA
  404.   IF EXIST TextHarvest-Error.txt GOTO ERROR
  405.   GOTO OKAY
  406.   :ERROR
  407.   ECHO An error occured!
  408.   GOTO DONE
  409.   :OKAY
  410.   ECHO Everything was fine!
  411.   :DONE
  412.   ECHO Processing completed
  413.   ùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùùù
  414. </HL>
  415. Note that the /CA parameter suppresses pop-up error messages, so if you use it in your batch file, it is up to your batch file to watch for the error file and then determine what to do if an error (such as "File not found") occurs.
  416.  
  417. <a name="MSGLOGFL"><H3>The Log File</H3>
  418.  
  419. In addition to the <a href="#ERRORFIL">Error Reporting File</a>, TextHarvest also creates a log file (named TextHarvest-Log.txt). TextHarvest uses the log file to record the date and time when processing started and ended. It also uses the log file to report anything that is slightly unusual but not a serious problem.
  420.  
  421. You can view the Log File using the "Support Files" input box of the Parsing Parameters window; it will be listed in the drop-down list.
  422.  
  423. <a name="USAGNOTS"><H1>Usage Notes</H1>
  424.  
  425. <a name="MATCHPRB"><H2>Matching Problems</H2>
  426.  
  427. <a name="FALSMATC"><H3>False Matches</H3>
  428.  
  429. Sometimes TextHarvest matches on strings of characters that you do not want matched. For example, if you set your /Keep list to /home/car while copying the sample file <a href="file://ThingsToDo.txt">ThingsToDo.txt</a> you will find that an additional line is included:
  430.  
  431. <HL>  WORK     Buy toner cartridge for laser printer</HL>
  432.  
  433. This was included because the characters "car" appear in the word "cartridge". You can get around this by explicitly indicating the space after "car":
  434.  
  435. <HL>  /home/car /</HL>
  436.  
  437. An alternative solution in this particular case would be to set the /Keep list to "/HOME/CAR" and the /Controls setting to "/KM" (Keep: match case).
  438.  
  439. <a name="FINDSLAS"><H3>Finding Slashes</H3>
  440.  
  441. You will normally separate the words in your /Keep and /Delete lists with the slash ("/") character (e.g. "/home/work"). But what if you are looking for a slash?  All you need to do is begin your word list with a different character, such as the "backslash" character ("\").
  442.  
  443. You can try processing the sample input file <a href="file://ThingsToDo.txt">ThingsToDo.txt</a> with the following "/Keep list" to see that this works as it should:
  444.  
  445. <HL>  \home\work</HL>
  446.  
  447. In other words, the first character in the list becomes the delimiter which separates the words.
  448.  
  449. <a name="FILEFMTS"><H2>File Formats</H2>
  450.  
  451. If you do not use scripts, TextHarvest can read either Windows-style (CRLF-terminated) text files or Unix-style (LF-terminated) text files, and output is always a Windows style (CRLF-terminated) text file.
  452.  
  453. If you do use scripts, TextHarvest can read all standard text files (including the Macintosh variety), fixed-record-length files, and character-terminated records, while output can be whatever you want it to be.
  454.  
  455. <a name="REGEXPRS"><H1>Regular Expression Syntax</H1>
  456.  
  457. <a name="REGEXPOV"><H2>Overview</H2>
  458.  
  459. TextHarvest supports most of the regular expression conventions. In the following list, the letters x, y and z stand in for any character.
  460. <HL>
  461.   ^xxx    Matches a sequence of characters at the start of a line
  462.   xxx$    Matches a sequence of characters at the end of line
  463.   x.x     Matches a single character
  464.   [xz]    Matches a set of characters ("x" and "z" in this example)
  465.   [x-z]   Matches a range of characters (this example covers "x" to "z")
  466.   x*      Matches zero or more occurrences of the preceding character
  467.   [xyz]*  Matches zero or more occurrences from the preceding set
  468.   [x-z]*  Matches zero or more occurrences from the preceding range
  469.   [^xyz]  Matches any character but the ones specified
  470.   [^x-z]  Matches any character but the ones in the specified range
  471. </HL>
  472. The backslash (\) character has a special meaning in regular expressions:
  473. <HL>
  474.   \x      Means "take the next character literally"
  475.           For example:  \[  means the actual  [  character
  476.           rather than the start of a set or range
  477.   \t      Means "a tab character" (ASCII character 9)
  478. </HL>
  479. <a name="REBASICS"><H2>Basic Regular Expressions</H2>
  480.  
  481. Note:  In the following examples, we assume that case sensitivity has been turned on, using the /KM or /DM setting in the "/Controls" input box.
  482.  
  483. Here are some examples of matches:
  484. <HL>
  485.   C.t        Matches Cat, Cot, Cut, Cxt, C3t etc.
  486.   C[aou]t    Matches Cat, Cot, Cut only
  487.   B..d       Matches Bird, Bred, Bead etc.
  488.   ^Dog       Matches Dog only if it is at the beginning of a line
  489.   Moose$     Matches Moose only if it is at the end of a line
  490.   Pa*d       Matches Pd, Pad, Paad, Paaad etc.
  491. </HL>
  492. <a name="RXAST"><H3>Using the Asterisk</H3>
  493.  
  494. The last example given above uses the * character to indicate zero, one or more occurrences of a particular character ù in this case, the letter "a". Unlike the * wildcard character used in file names, it does not match "any" character but is specific. That is why "Pa*d" would not match "Parsed"; the asterisk means "match zero or more of the preceding character specification".
  495.  
  496. If you actually want to search for "Pa" followed by one or more letters and then "d", the correct syntax is:
  497.  
  498. <HL>  Pa[a-z][a-z]*d</HL>
  499.  
  500. This means that we want to match "Pa", then a letter in the range from "a" to "z", then some number (including zero) of characters in the "a" to "z" range, and finally the letter "d". The character string "Parsed" would meet these criteria, as would "Pad", "Paid" and "Packed".
  501.  
  502. <a name="REASTERK"><H2>Advanced Regular Expressions</H2>
  503.  
  504. Note:  In the following examples, we assume that case sensitivity has been turned on, using the /KM or /DM setting in the "/Controls" input box.
  505.  
  506. Here are some more complicated examples of regular expressions:
  507. <HL>
  508.   C[^ou]t        Matches Cat, Cxt and so on, but not Cot or Cut
  509.   C[ao]*t        Matches Ct, Cat, Caat, Cot, Coot, Cooot, Coat, Coaoat etc.
  510.   [0-9][0-9]*    Matches numbers such as 0, 1, 01, 10, 25, 0990, 9999 etc.
  511.   -[0-9][0-9]*   Matches negative numbers such as -0, -1, -19, -12345 etc.
  512. </HL>
  513. In the last example, [0-9] is specified twice to ensure that at least one digit is found. Bear in mind that the * character means "zero or more occurrences". If you had specified "-[0-9]*" you would get a match within the sequence "Hello - there", since the "-" character is indeed found, followed by zero occurrences of the digits 0 through 9.
  514.  
  515. You can create fairly complex patterns using regular expressions. Consider this example:
  516.  
  517. <HL>  \$[0-9][0-9]*\.[0-9][0-9]</HL>
  518.  
  519. This would match dollar amounts with two decimal places, such as $0.00, $03.23, $3.14, $9.99, $1234.56 and so on.
  520.  
  521. <a name="SCRIPTNG"><H1>Scripting</H1>
  522.  
  523. Parse-O-Matic Scripting lets you modify the results generated by TextHarvest.
  524.  
  525. Scripting can examine the text lines that are retained after TextHarvest's /Keep and /Delete settings are taken into account. You could, for example:
  526. <hl>
  527.   ò Replace one string of text with another one
  528.   ò Convert some of the line to uppercase
  529.   ò Eliminate certain lines on the basis of multiple criteria
  530.   ò Rearrange the order of data items in a line
  531.   ò Add up numbers and include totals at the end of the output
  532. </hl>
  533. All this ù and much, much more ù is possible with Parse-O-Matic Scripting.
  534.  
  535. When using a script you will generally leave the /Keep and /Delete input boxes empty, since the script can do this kind of selection. The /Controls input box can be set to /NK to keep null lines or /NI (default) to ignore null lines.
  536.  
  537. <a name="SCSEXAMP"><H2>A Simple Example</H2>
  538.  
  539. Here is a very simple example, using the sample <a href="file://ThingsToDo.txt">ThingsToDo.txt</a> file. Let us say you wanted to convert the "category" (CAT, CAR, HOME, WORK, LEISURE) to lowercase. To do this, you would use a text editor program to write a script file (let's call it <a href="file://ScrExperiment.txt">ScrExperiment.txt</a>) that looks like this:
  540. <hl>
  541.   Category = $OutData[1 9]
  542.   Description = $OutData[10 999]
  543.   Category = ChangeCase Category 'Lowercase'
  544.   OutEnd Category Description
  545. </hl>
  546. The first two lines extract the two parts of the output data from the variable named $OutData, which contains the line of text from TextHarvest. The third line converts the category to lowercase, while the final line sends the modified line to the output file. (Whenever you run TextHarvest's results through a script, it is up to the script to actually send the lines to the output file.)
  547.  
  548. To run this script, you would enter its name ù we called it <a href="file://ScrExperiment.txt">ScrExperiment.txt</a> ù in the "Script File" input box of the Parsing Parameters window, then click the Start button.
  549.  
  550. If you do <i>not</i> want to run a script ù i.e. you simply want to use TextHarvest as a basic filter ù enter "None" (without the quotes) in the "Script File" input box.
  551.  
  552. <a name="SCRUSERM"><H2>Scripting User Manual</H2>
  553.  
  554. A complete user manual for Parse-O-Matic Scripting is included with TextHarvest.
  555.  
  556. Click <a href="exec:PommelScan">here</a> to access the "Parse-O-Matic Scripts" user manual.
  557.  
  558. <a name="SCSAMPLE"><H2>Sample Scripts</H2>
  559.  
  560. Here is a list of the sample scripts included with TextHarvest:
  561. <hl>
  562.   ùùùùùùùùùùùùùùùùùù   ùùùùùùùùùùùùùùùùù    ùùù   ùùùùùùùùùùùùùùùùùùùùùùùùù
  563.   Script File Name     Input File to Use    Adv   Comments
  564.   ùùùùùùùùùùùùùùùùùù   ùùùùùùùùùùùùùùùùù    ùùù   ùùùùùùùùùùùùùùùùùùùùùùùùù
  565.   <a href="file://ScriptSample01.txt">ScriptSample01.txt</a>   ThingsToDo.txt        -
  566.   <a href="file://ScriptSample02.txt">ScriptSample02.txt</a>   ThingsToDo.txt        -
  567.   <a href="file://ScriptSample03.txt">ScriptSample03.txt</a>   InputSample01.txt     -
  568.   <a href="file://ScriptSample04.txt">ScriptSample04.txt</a>   ToDoListFixed.dat     -    Fixed-record-length input
  569.   <a href="file://ScriptSample05.txt">ScriptSample05.txt</a>   ToDoListDelim.dat     -    Character-delimited input
  570.   <a href="file://ScrSampleAdv01.txt">ScrSampleAdv01.txt</a>   ThingsToDo.txt        Y
  571.   <a href="file://ScrSampleAdv02.txt">ScrSampleAdv02.txt</a>   Scr*.txt              Y    Input file uses wildcard
  572.   <a href="file://ScrExercise.txt">ScrExercise.txt</a>      ThingsToDo.txt        Y    Demonstrates <b>all</b> commands
  573.   ùùùùùùùùùùùùùùùùùù   ùùùùùùùùùùùùùùùùù    ùùù   ùùùùùùùùùùùùùùùùùùùùùùùùù
  574.  
  575.   Adv = Uses Advanced Scripting commands (see the Scripting user manual).
  576. </hl>
  577. It is best to study these scripts in the order they are listed above. To view a script, click on the button with the folder icon next to the "Script File" input box. You can then select a script and view it by clicking the View button.
  578.  
  579. To try out the sample script <a href="file://ScriptSample01.txt">ScriptSample01.txt</a>:
  580. <hl>
  581.   ò Set your "Input File" box to ThingsToDo.txt
  582.   ò Set the "Output File" box to an appropriate file name (e.g. Output.txt)
  583.   ò Make sure Autoview is checked and Append is <i>not</i> checked
  584.   ò Clear your "/Keep list", "/Delete list" and "/Controls" input boxes
  585.   ò Set the "Script File" input box to ScriptSample01.txt
  586.   ò Click the Start button
  587. </hl>
  588. Once the output file is displayed, you may find it helpful to also view the input file, so you can understand how the output data was transformed.
  589.  
  590. <a name="UNINSTAL"><H1>Uninstalling TextHarvest</H1>
  591.  
  592. If you should need to uninstall TextHarvest, start up the Windows Control Panel, then click on Add/Remove Programs. Find TextHarvest on the list, and proceed with removal.
  593.  
  594. <a name="CUSTOMCO"><H1>Custom Conversion</H1>
  595.  
  596. TextHarvest is handy and simple to use, but it has its limitations. That is a perennial problem with utilities:  there always seems to be one feature missing ù one that you urgently need!
  597.  
  598. We invite you to visit <a href="http://www.parse-o-matic.com">our web site</a> if you need a custom conversion application. Our company has been doing data conversion since 1985.
  599.  
  600. <a name="LEGALESE"><h1>Legal Notices</h1>
  601.  
  602. TextHarvest<fs x="1.5">™</fs> and Parse-O-Matic<fs x="1.5">™</fs> are trademarks of Pinnacle Software.<fs x="0.75">
  603.  
  604. </fs>This document is Copyright <fs x="1.25">©</fs> 2003 by Pinnacle Software. You may not distribute copies of this document without explicit permission from Pinnacle Software, except in conjunction with the complete and unaltered TextHarvest installation package. Please <a href="mailto:info@parse-o-matic.com">write to us</a> if you would like to adapt this product or any of our other products to your own distributed application.
  605.  
  606. The entire product (comprising software, documentation and supporting provisions) is presented as-is; we make no claim about (and disavow liability for) its suitability, accuracy, reliability, performance etc. If you should encounter a problem with the product, please <a href="mailto:info@parse-o-matic.com">write to us</a> to find out if a solution is available.